import com.sun.xml.internal.ws.addressing.WsaActionUtil;

import javax.swing.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 徐海涛
 * Date: 2021-11-22
 * Time: 23:59
 */
public class TestDemo {
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5,6};
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if (j%2==0) {
                    int tmp = array[i];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                }
            }

        }
    }

    public static void main13(String[] args) {
        System.out.println(sumAdd(10,20));
        System.out.println(sumAdd(10,20,30));
    }
    public static int sumAdd(int a ,int b) {
        return a + b;
    }
    public static int sumAdd(int a ,int b ,int c) {
        return a + b + c;
    }

    public static void main12(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println("奇数位" + " ");
        for (int i = 31; i >=1 ; i++) {
            System.out.println(n>>i&1);
        }
        System.out.println("偶数位");
        for (int i = 30; i >=0 ; i++) {
            System.out.println(n>>>i&1);
        }
    }



    public static void main11(String[] args) {
        for (int i = 1; i <=9 ; i++) {
            for (int j = 1; j <=i ; j++) {
                System.out.println(i + "*" + j + "=" + i*j);
            }
        }
    }
    public static void main10(String[] args) {
        int totol = 0;
        int n = 10;
        for (int i = 0; i <= n ; i++) {
            totol = totol + fac(n);
        }
        System.out.println(totol);
    }
    public static int fac(int n) {
        if(n==1) {
            return 1;
        } else {
            return n*fac(n-1);
        }
    }
    public static void main9(String[] args) {
        int b = 50;
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输出你要猜的数字");
            int n = scanner.nextInt();
            if (n < b) {
                System.out.println("猜小了");
            } else if (n>b) {
                System.out.println("猜大了");
            } else {
                System.out.println("猜对了");
                break;
            }
        }
    }
    public static void main8(String[] args) {
        System.out.println(0-999 + "中水鲜花数");
        int count = 0;
        for (int i = 100; i <1000; i++) {
            int one = i%10;
            int two = i/10%10;
            int three = i/100;
            if (one*one*one + two*two*two + three*three*three == i) {
                System.out.println(i);
                count++;
            }
        }
        System.out.println("水仙花数有" + count + "个");
    }
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        while (n != 0) {
            if ((n&1)==1) {
                count++;
            }
            n = n>>>1;
        }
        System.out.println(count);
    }

    public static void main6(String[] args) {
        int a = 28;
        int b = 18;
        int c = a % b;
        if (a % b != 0) {
            a = b;
            b = c;
            c =  a % b;
        }
        System.out.println(b);
    }

    public static void main5(String[] args) {
        double sum = 0.0;
        int flg = 1;
        for (int i = 1; i <=100 ; i++) {
            sum = sum + 1.0/i*flg;
            flg = -flg;
        }
        System.out.println(sum);
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 2; i < n ; i++) {
            if (n % i == 0) {
                System.out.println("不是素数");
                break;
            }
            if (n==i) {
                System.out.println("是素数");
            }
        }
        System.out.println();
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) {
                    System.out.print("*");
                } else if (i + j == n-1) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println(); //循环结束要打印
        }
    }
    public static void main2(String[] args) {
        int i,j;
        for ( i = 2; i < 100 ; i++) {
            for (j = 2; j < i; j++) {
                if (i % j == 0) {
                    break;
                }
            }
            if (i == j) {
                System.out.println(i);
            }
        }
    }
    public static void main1(String[] args) {
        int count = 0;
        for (int i = 0; i <=100; i++) {
            if(i % 10 == 9) {
                count++;
            }else if(i / 10 ==9) {
                count++;
            }
        }
        System.out.println(count);
    }

}
